//
//  UIButton+Extension.swift
//  Hyy9Weibo
//
//  Created by Air on 16/4/6.
//  Copyright © 2016年 hyy. All rights reserved.
//

import UIKit

extension UIButton{
    
    /**
     快速创建按钮
     
     - parameter title:        标题
     - parameter imageName:    图片名称
     - parameter bkgImageName: 背景图片
     - parameter textColor:    文字颜色
     - parameter textFont:     文字大小
     
     - returns: 按钮
     */
    convenience init(title:String, imageName:String, bkgImageName:String = "timeline_card_bottom_background",textColor:UIColor = UIColor.lightGrayColor(),textFont:CGFloat = HYYStatusCellButtonDefaultFontSize){
        self.init()
        //设置
        self.setBackgroundImage(UIImage(named:bkgImageName), forState: UIControlState.Normal)
        self.setBackgroundImage(UIImage(named:"\(bkgImageName)_highlighted"), forState: UIControlState.Highlighted)
        
        self.setImage(UIImage(named:imageName), forState: UIControlState.Normal)
        self.setTitle(title, forState: UIControlState.Normal)
        self.setTitleColor(textColor, forState: UIControlState.Normal)
        self.titleLabel?.font = UIFont.systemFontOfSize(textFont)
    }
}
